<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition xmlns:ui="http://java.sun.com/jsf/facelets"
                template="/resources/template/template.xhtml"
                xmlns:h="http://java.sun.com/jsf/html"
                xmlns:p="http://primefaces.org/ui"
                xmlns:f="http://java.sun.com/jsf/core"
                xmlns:pe="http://primefaces.org/ui/extensions">

    <ui:define name="content">
        <h:form>
            <p:panel header=" Asset Transfer Report">
                <h:panelGrid columns="2" styleClass="noPrintButton">
                    <h:outputLabel value="From Date"/>
                    <p:calendar value="#{storeSaleReport.fromDate}" navigator="true" pattern="dd MMMM yyyy hh:mm:ss a"  >
                    </p:calendar>
                    <h:outputLabel value="To Date"/>
                    <p:calendar value="#{storeSaleReport.toDate}" navigator="true" pattern="dd MMMM yyyy hh:mm:ss a" >
                    </p:calendar>
                    <h:outputLabel value="From Department"/>
                    <p:autoComplete styleClass="noPrintButton"  value="#{storeSaleReport.department}"  id="fromDep" style="text-align: left; margin: 0px; padding: 0px;"  completeMethod="#{departmentController.completeDept}" var="dept" itemValue="#{dept}" itemLabel="#{dept.name}" forceSelection="true" rendered="true" requiredMessage="You must select a department" >
                    </p:autoComplete>
                    <h:outputLabel value="To Department"/>
                    <p:autoComplete styleClass="noPrintButton"  value="#{storeSaleReport.toDepartment}"  id="toDep" style="text-align: left; margin: 0px; padding: 0px;"  completeMethod="#{departmentController.completeDept}" var="dept" itemValue="#{dept}" itemLabel="#{dept.name}" forceSelection="true" rendered="true" requiredMessage="You must select a department" >
                    </p:autoComplete>
                    
                </h:panelGrid>
                <p:watermark value="From Department" for="fromDep"/>
                <p:watermark value="To Department" for="toDep"/>
               </p:panel> <p:panel id="panelPrint" >
                <h:panelGrid columns="3">
                    <p:commandButton ajax="false" value="Process" action="#{storeSaleReport.getTransIssueValueByDate()}"  styleClass="noPrintButton"/>
                    <p:commandButton ajax="false" value="Excel" actionListener="#{storeSaleReport.getTransIssueValueByDate()}" styleClass="noPrintButton" style="float: right;" >
                        <pe:exporter type="xlsx" target="sum1" fileName="report_store_issue_by_item_summery"  />
                    </p:commandButton>
                    <p:commandButton ajax="false" value="Print" styleClass="noPrintButton" >
                        <p:printer target="panelPrint" />
                    </p:commandButton>
                </h:panelGrid>

                <p:dataTable id="sum1" value="#{storeSaleReport.billItem}" var="i">   
                    <f:facet name="header">
                        <h:outputLabel value="Transfer Issue Summary Report By Date"/>
                         <h:outputLabel value="&emsp; &emsp;From : "  style=" white-space:pre-line;"/>
                         <h:outputLabel value="#{storeSaleReport.department.name}"/>
                         <h:outputLabel value=" &emsp; &emsp;To : " />
                        <h:outputLabel value="#{storeSaleReport.toDepartment.name}"/>
                    <h:outputLabel value="&emsp; &emsp;From  :  " style=" white-space:pre-line;"/>
                    <h:outputLabel value="#{storeSaleReport.fromDate}"  >
                        <f:convertDateTime pattern="dd MMMM yyyy hh:mm:ss a" />
                    </h:outputLabel>
                    <h:outputLabel value=" &emsp; &emsp;To : "/>
                    <h:outputLabel value="#{storeSaleReport.toDate}"  >
                        <f:convertDateTime pattern="dd MMMM yyyy hh:mm:ss a" />
                    </h:outputLabel> 
                    </f:facet>
                    
                    <p:column headerText="Bill No">
                        <f:facet name="header">
                            <h:outputLabel value="Bill No" />
                        </f:facet>
                        <h:outputLabel value="#{i.bill.insId}" />
                    </p:column>
                    
                    <p:column headerText="Date">
                        <f:facet name="header">
                            <h:outputLabel value="Date" />
                        </f:facet>
                        <h:outputLabel value="#{i.bill.createdAt}" />
                    </p:column>
                    
                    <p:column headerText="Item Code">
                        <f:facet name="header">
                            <h:outputLabel value="Item Code" />
                        </f:facet>
                        <h:outputLabel value="#{i.item.code}" />
                    </p:column>
                    
                    <p:column headerText="Batch No">
                        <f:facet name="header">
                            <h:outputLabel value="Batch No" />
                        </f:facet>
                        <h:outputLabel value="#{i.pharmaceuticalBillItem.itemBatch.batchNo}" />
                    </p:column>
                    
                    <p:column headerText="Item Description">
                        <f:facet name="header">
                            <h:outputLabel value="Item Description" />
                        </f:facet>
                        <h:outputLabel value="#{i.item.name}" />
                    </p:column>
                    
                    <p:column headerText="Quentity">
                        <f:facet name="header">
                            <h:outputLabel value="Quentity" />
                        </f:facet>
                        <h:outputLabel value="#{i.qty}" />
                    </p:column>
                    
                    <p:column headerText="Cost">
                        <f:facet name="header">
                            <h:outputLabel value="Cost" />
                        </f:facet>
                        <h:outputLabel value="#{i.pharmaceuticalBillItem.itemBatch.purcahseRate}" />
                    </p:column>
                    
                    <p:column headerText="Value">
                        <f:facet name="header">
                            <h:outputLabel value="Value" />
                        </f:facet>
                        <h:outputLabel value="#{i.pharmaceuticalBillItem.itemBatch.purcahseRate*i.qty}" />
                    </p:column>
                    
                    <p:column headerText="Location From">
                        <f:facet name="header">
                            <h:outputLabel value="Location From" />
                        </f:facet>
                        <h:outputLabel value="#{i.bill.department.name}" />
                    </p:column>
                    
                    <p:column headerText="Location To">
                        <f:facet name="header">
                            <h:outputLabel value="Location To" />
                        </f:facet>
                        <h:outputLabel value="#{i.bill.toDepartment.name}" />
                    </p:column>
                <f:facet name="footer" >
                    <h:outputLabel value="Printed By : #{sessionController.loggedUser.webUserPerson.name}" style="float: right"/>
                </f:facet>
                    
                    
                </p:dataTable>

                

            </p:panel>         


        </h:form>

    </ui:define>



</ui:composition>
